package com.cy.demo1.controller;

import com.cy.demo1.entity.Result1;
import com.cy.demo1.entity.Result2;
import com.cy.demo1.service.IAlgorithmService;
import com.cy.demo1.util.JsonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;

@RestController
public class AlgorithmController extends BaseController{

    @Resource
    private IAlgorithmService algorithmService;

    @RequestMapping("callAlgorithm1")
    public JsonResult<Result1> callAlgorithm1(Integer projectId) throws IOException {
        Result1 data = algorithmService.getResult1(projectId);

        return new JsonResult<Result1>(OK, data);
    }

    @RequestMapping("callAlgorithm2")
    public JsonResult<Result2> callAlgorithm2(Integer projectId) {
        Result2 data = algorithmService.getResult2(projectId);
        //System.out.println("id:"+projectId);
        return new JsonResult<Result2>(OK, data);
    }
}
